﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using System.Diagnostics;
using System.Reflection;

namespace IRC.IRepairClouds.DataLayer.Expressions
{
    partial class Extensions
    {
        public static UnaryExpressionBuilder<Int32> ArrayLength<TElement>(this ExpressionBuilder<TElement[]> array)
        {
            return Expression.ArrayLength(array);//.ToExpressionBuilder<Int32>();
        }

        public static UnaryExpressionBuilder<Int32> ArrayLength<TElement>(this ExpressionBuilder<TElement[,]> array)
        {
            return Expression.ArrayLength(array);//.ToExpressionBuilder<Int32>();
        }

        public static UnaryExpressionBuilder<Int32> ArrayLength<TElement>(this ExpressionBuilder<TElement[,,]> array)
        {
            return Expression.ArrayLength(array);//.ToExpressionBuilder<Int32>();
        }

        public static UnaryExpressionBuilder<Int32> ArrayLength<TElement>(this ExpressionBuilder<Array> array)
        {
            return Expression.ArrayLength(array);//.ToExpressionBuilder<Int32>();
        }

        public static UnaryExpressionBuilder<TTo> Convert<TTo>(this ExpressionBuilder expression)
        {
            return Expression.Convert(expression, typeof(TTo));//.ToExpressionBuilder<TTo>();
        }
        public static UnaryExpressionBuilder<TTo> Convert<T, TTo>(this ExpressionBuilder expression, Func<T, TTo> method)
        {
            return Expression.Convert(expression, typeof(TTo), method.Method);//.ToExpressionBuilder<TTo>();
        }

        public static UnaryExpressionBuilder<TTo> ConvertChecked<TTo>(this ExpressionBuilder expression)
        {
            return Expression.ConvertChecked(expression, typeof(TTo));//.ToExpressionBuilder<TTo>();
        }
        public static UnaryExpressionBuilder<TTo> ConvertChecked<T, TTo>(this ExpressionBuilder expression, Func<T, TTo> method)
        {
            return Expression.ConvertChecked(expression, typeof(TTo), method.Method);//.ToExpressionBuilder<TTo>();
        }

        public static UnaryExpressionBuilder<T> Negate<T>(this ExpressionBuilder<T> expression)
        {
            return Expression.Negate(expression);//.ToExpressionBuilder<T>();
        }
        public static UnaryExpressionBuilder<T> Negate<T>(this ExpressionBuilder<T> expression, Func<T, T> method)
        {
            return Expression.Negate(expression, method.Method);//.ToExpressionBuilder<T>();
        }

        public static UnaryExpressionBuilder<T> NegateChecked<T>(this ExpressionBuilder<T> expression)
        {
            return Expression.NegateChecked(expression);//.ToExpressionBuilder<T>();
        }
        public static UnaryExpressionBuilder<T> NegateChecked<T>(this ExpressionBuilder<T> expression, Func<T, T> method)
        {
            return Expression.NegateChecked(expression, method.Method);//.ToExpressionBuilder<T>();
        }

        public static UnaryExpressionBuilder<T> Not<T>(this ExpressionBuilder<T> expression)
        {
            return Expression.Not(expression);//.ToExpressionBuilder<T>();
        }
        public static UnaryExpressionBuilder<T> Not<T>(this ExpressionBuilder<T> expression, Func<T, T> method)
        {
            return Expression.Not(expression, method.Method);//.ToExpressionBuilder<T>();
        }

        public static UnaryExpressionBuilder<T> Quote<T>(this ExpressionBuilder<T> expression)
        {
            return Expression.Quote(expression);//.ToExpressionBuilder<T>();
        }

        public static UnaryExpressionBuilder<TTo> TypeAs<TTo>(this ExpressionBuilder expression)
        {
            return Expression.TypeAs(expression, typeof(TTo));//.ToExpressionBuilder<TTo>();
        }

        public static UnaryExpressionBuilder<T> UnaryPlus<T>(this ExpressionBuilder<T> expression)
        {
            return Expression.UnaryPlus(expression);//.ToExpressionBuilder<T>();
        }

        public static UnaryExpressionBuilder<T> UnaryPlus<T>(this ExpressionBuilder<T> expression, Func<T, T> method)
        {
            return Expression.UnaryPlus(expression, method.Method);//.ToExpressionBuilder<T>();
        }
    }
}
